﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using YAPL.Language.Ast;
using YAPL.Util;

namespace YAPL.Language.SourceParser.XML.NodeParsers {
	public class XmlReturnParser : XmlExpressionParser {
		public XmlReturnParser(XmlInputParser inputParser) : base(inputParser) {}
		public override Expression ParseNode(XElement node) {
			Require.True(node.Elements().Count() == 1);
			var	returnNode = node.Elements().First();
			Require.NotNull(returnNode);
			return Expressions.ReturnStatement(Parser.ParseNode(returnNode));
		}
	}
}
